home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
cprog.EXE
/
FREE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-30
|
3KB
|
81 lines
/* **************************************************************** */
/* **** *** */
/* **** GOKHAN KUCUKTOPUZLU *** */
/* **** *** */
/* **** Diskteki Toplam Alani ve Bos Alani Bulur. *** */
/* **** *** */
/* **** Kullanim : FREE *** */
/* **** FREE C: *** */
/* **** *** */
/* **************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include <dir.h>
#include <dos.h>
void main(int c, char *drv[])
{
struct dfree free;
long Avail, Total;
int drive, len1, len2;
register int i, x;
char ch;
char *Longstr1, *Longstr2;
char *long1, *long2;
ch = drv[1][0];
printf( " \nGOKHAN KUCUKTOPUZLU 1993\n\n");
if( c < 2)
drive = getdisk();
else {
if( ch >= 97 && ch <= 122 )
drive = (int ) ch - 97;
else if( ch >= 65 && ch <= 90 )
drive = (int ) ch - 65;
}
getdfree( drive + 1, &free );
if( free.df_sclus == 0xFFFF )
{
printf( "getdfree() fonksiyonu cagiriminda hata !!!\n" );
exit(1);
}
Avail = ( long ) free.df_avail * ( long ) free.df_bsec * (long) free.df_sclus;
Total = ( long ) free.df_total * ( long ) free.df_bsec * (long) free.df_sclus;
Longstr1 = ( char * ) malloc( 15 );
Longstr2 = ( char * ) malloc( 15 );
ultoa( Avail, Longstr1, 10 );
ultoa( Total, Longstr2, 10 );
Longstr1 = strrev( Longstr1 );
Longstr2 = strrev( Longstr2 );
len1 = strlen( Longstr1 );
len2 = strlen( Longstr2 );
long1 = ( char * ) malloc( len1 );
long2 = ( char * ) malloc( len2 );
long1[0] = 0;
long2[0] = 0;
x=-1;
for( i = 1; i < len1 + 1; i++ ) {
x++;
long1[x] = Longstr1[i - 1];
if( (i % 3) == 0 && i < len1 ) {
long1[x + 1] = ',';
x++;
}
}
long1[x + 1] = 0;
x=-1;
for( i = 1; i < len2 + 1; i++ ) {
x++;
long2[x] = Longstr2[i-1];
if( (i % 3) == 0 && i < len2 ) {
long2[x + 1] = ',';
x++;
}
}
long2[x + 1] = 0;
long1 = strrev( long1 );
long2 = strrev( long2 );
printf( "%c: Surucusunde;\nToplam Alan......: %+15s Byte\n", 'A' + drive, long2 );
printf( "Bos Alan.........: %+15s Byte\n", long1 );
}